<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - render_face_detections.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2014  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#ifndef</font> DLIB_RENDER_FACE_DeTECTIONS_H_
<font color='#0000FF'>#define</font> DLIB_RENDER_FACE_DeTECTIONS_H_

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='full_object_detection.h.html'>full_object_detection.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../gui_widgets.h.html'>../gui_widgets.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='render_face_detections_abstract.h.html'>render_face_detections_abstract.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>vector<font color='#5555FF'>&gt;</font>

<font color='#0000FF'>namespace</font> dlib
<b>{</b>
    <font color='#0000FF'>inline</font> std::vector<font color='#5555FF'>&lt;</font>image_window::overlay_line<font color='#5555FF'>&gt;</font> <b><a name='render_face_detections'></a>render_face_detections</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::vector<font color='#5555FF'>&lt;</font>full_object_detection<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> dets,
        <font color='#0000FF'>const</font> rgb_pixel color <font color='#5555FF'>=</font> <font color='#BB00BB'>rgb_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>255</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font>
    <font face='Lucida Console'>)</font>
    <b>{</b>
        std::vector<font color='#5555FF'>&lt;</font>image_window::overlay_line<font color='#5555FF'>&gt;</font> lines;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> dets.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>dets[i].<font color='#BB00BB'>num_parts</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>68</font>,
                "<font color='#CC0000'>\t std::vector&lt;image_window::overlay_line&gt; render_face_detections()</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t Invalid inputs were given to this function. </font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n\t dets[</font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>i<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>].num_parts():  </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> dets[i].<font color='#BB00BB'>num_parts</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> 
            <font face='Lucida Console'>)</font>;

            <font color='#0000FF'>const</font> full_object_detection<font color='#5555FF'>&amp;</font> d <font color='#5555FF'>=</font> dets[i];
            <font color='#009900'>// Around Chin. Ear to Ear
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>1</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>16</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                
            <font color='#009900'>// Line on top of nose
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>28</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>30</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            
            <font color='#009900'>// left eyebrow
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>18</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>21</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#009900'>// Right eyebrow
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>23</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>26</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#009900'>// Bottom part of the nose
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>31</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>35</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#009900'>// Line from the nose to the bottom part above
</font>            lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>30</font><font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>35</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

            <font color='#009900'>// Left eye
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>37</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>41</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>36</font><font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>41</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

            <font color='#009900'>// Right eye
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>43</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>47</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>42</font><font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>47</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

            <font color='#009900'>// Lips outer part
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>49</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>59</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>48</font><font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>59</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

            <font color='#009900'>// Lips inside part
</font>            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>61</font>; i <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> <font color='#979000'>67</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
                lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            lines.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>image_window::<font color='#BB00BB'>overlay_line</font><font face='Lucida Console'>(</font>d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>60</font><font face='Lucida Console'>)</font>, d.<font color='#BB00BB'>part</font><font face='Lucida Console'>(</font><font color='#979000'>67</font><font face='Lucida Console'>)</font>, color<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>return</font> lines;
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>inline</font> std::vector<font color='#5555FF'>&lt;</font>image_window::overlay_line<font color='#5555FF'>&gt;</font> <b><a name='render_face_detections'></a>render_face_detections</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> full_object_detection<font color='#5555FF'>&amp;</font> det,
        <font color='#0000FF'>const</font> rgb_pixel color <font color='#5555FF'>=</font> <font color='#BB00BB'>rgb_pixel</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>255</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font>
    <font face='Lucida Console'>)</font>
    <b>{</b>
        std::vector<font color='#5555FF'>&lt;</font>full_object_detection<font color='#5555FF'>&gt;</font> dets;
        dets.<font color='#BB00BB'>push_back</font><font face='Lucida Console'>(</font>det<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>return</font> <font color='#BB00BB'>render_face_detections</font><font face='Lucida Console'>(</font>dets, color<font face='Lucida Console'>)</font>;
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_RENDER_FACE_DeTECTIONS_H_
</font>

</pre></body></html>